﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Quartz;
using log4net;
using Quartz.Impl;
using LuceneNetServices.Models;
namespace LuceneNetServices.Jobs
{
    public class QuzrtaNet : IJob
    {//job就只定义job就可以 不需要在里面定义触发器
        private static ILog log = LogManager.GetLogger(typeof(QuzrtaNet));
        public void Execute(IJobExecutionContext context)
        {
            string m_strJobName = context.JobDetail.Key.Name;
            if (context.RefireCount == LogCfg.RefireCount)
            {
                log.Info(m_strJobName + "任务 重试" + LogCfg.RefireCount);
                return;
            }
            try
            {
                Index index = new Index();
                index.CreateIndex();
            }
            catch (Exception ex)
            {
                log.Error("创建索引失败",ex);
            }
        }
    }
}
